home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
HAM_RAD
/
PROPAGAT
/
1004A.ZIP
/
MOON-SEK.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-05-12
|
10KB
|
241 lines
1 ' *** MOON TRACKING PROGRAM *** from "Amateur Radio Software"
2 ' by John Morris, GM4ANB (c) RSGB (available from ARRL).
3 ' For full explanation of astronomical aspects, read the book!
4 ' Microsoft BASIC version with mods by G3SEK and G4PMK, September 1983
5 ' Sky temperature and input routines by G3SEK, 1984
6 '
7 ESC$=CHR$(27): FF$=CHR$(12): CR$=CHR$(13) ' standard printer control codes.
8 ' Setup string for Centronics PS240. Use LPINIT$="" for Epson compatibles.
9 LPINIT$ = ESC$+CR$+"P" +CR$+CR$ +ESC$+"x"+CHR$(2) +ESC$+FF$+CHR$(70)
10 PI=3.141592654000005# :TP=PI*2:PT=PI/2
20 RD=180/PI:DR=PI/180
30 C1=.9174640600000014#:S1=.397818675#
40 DIM SKY(24,6):GOSUB 15000
50 DEF FNA(X)=SGN(X)*INT(10*RD*ABS(X)+.5)/10
60 DEF FNB(X)=TP*(X/TP-INT(X/TP))
70 DEF FNC(X)=X-INT(X)
80 PRINT:PRINT
89 ' Change Drayton in line 90 to your own home location.
90 INPUT"Press [return] if QTH is Drayton. Input N for new QTH. ",T$
91 ' Change N and E in line 95 to home lat and long in RADIANS north of
92 ' equator and *EAST* of Greenwich.
94 ' Southern and western hemispheres are NEGATIVE.
95 PRINT:PRINT:IF T$<>"N" THEN N=.90108:E=-.022835:GOTO 300
100 INPUT" Latitude (whole degrees) : ",T1
110 INPUT" (decimal minutes) : ",T2
120 INPUT" North or South? (N/S) : ",T$
130 T$=LEFT$(T$,1):IF T$<>"N" AND T$<>"S" GOTO 120
140 N=DR*(T1+T2/60):IF T$="S" THEN N=-N
150 INPUT" Longitude (whole degrees) : ",T1
160 INPUT " (decimal minutes) : ",T2
170 INPUT " East or West? (E/W) : ",T$
180 T$=LEFT$(T$,1):IF T$<>"E" AND T$<>"W" GOTO 170
190 E=DR*(T1+T2/60):IF T$="W" THEN E=-E
192 GOTO 300
199 ' RE-ENTRY MENU
200 PRINT:INPUT"Repeat (Y/N)? <return=Y> : ",T$:IF T$="N" OR T$="n" THEN END
205 IP=0:INPUT "Printout (Y/N)? <return=N> : ",T$:IF T$="Y" OR T$="y" THEN IP=-1:LPRINT LPINIT$;
210 PRINT:PRINT:PRINT"Old parameters were:":PRINT"Start date ";ODY;"/";OMN;"/";OYR
220 PRINT"Start time ";OT1:PRINT"Interval (mins) ";ODT:PRINT"Moonsets ";OSS
230 PRINT:PRINT"Input 0 to repeat old calculation"
232 PRINT" 1 to change Start date including-"
234 PRINT" 2 to change Start time including-"
236 PRINT" 3 to change Interval including-"
238 PRINT" 4 to change Number of moonsets":PRINT"or 9 to exit":PRINT:PRINT
240 INPUT": ",NRPT:IF NRPT<0 GOTO 240 ELSE IF NRPT>4 THEN END
245 IF NRPT=0 THEN DY=ODY:MN=OMN:YR=OYR:GOSUB 9800:GOSUB 8000:T1=OT1:DT=ODT:SS=OSS:GOTO 420
250 IF NRPT=1 GOTO 300
260 IF NRPT=2 THEN DY=ODY:MN=OMN:YR=OYR:GOSUB 9800:GOSUB 8000:GOTO 400
270 IF NRPT=3 THEN DY=ODY:MN=OMN:YR=OYR:GOSUB 9800:GOSUB 8000:T1=OT1:GOTO 410
280 IF NRPT=4 THEN DY=ODY:MN=OMN:YR=OYR:GOSUB 9800:GOSUB 8000:T1=OT1:DT=ODT:GOTO 415
290 PRINT CHR$(7):GOTO 240
300 INPUT"Day of month (1-31) : ",DY:IF DY=0 THEN GOTO 300 ELSE ODY=DY
310 INPUT"Month number (1-12) : ",MN:IF MN=0 THEN GOTO 310 ELSE OMN=MN
320 INPUT"Year <return = 1987> : ",YR:IF YR=0 THEN YR=1987
325 IF YR<100 THEN YR=YR+1900
330 OYR=YR:GOSUB 9800
340 GOSUB 8000
350 PRINT:PRINT
400 INPUT"GMT start (hhmm) <return = 0000> : ",T1:OT1=T1
410 INPUT"Interval (minutes) <return = 60> : ",DT:IF DT=0 THEN DT=60
411 ODT=DT
415 INPUT"Number of moonsets <return = 1> : ",SS:IF SS=0 THEN SS=1
416 OSS=SS
420 ST=0:UP=0:T1=T1/100
430 GM=(60*INT(T1)+FNC(T1)*100)/60
440 DT=DT/60
1000 GOSUB 8100:GOSUB 8200
1005 MN$=MID$("JanFebMarAprMayJunJulAugSepOctNovDec",3*MN-2,3)
1010 PRINT:PRINT D$,DY;" ";MN$;" ";YR
1020 PRINT:PRINT
1100 PRINT" GMT";TAB(15);"AZIMUTH";TAB(25);"ELEVATION";TAB(43);"ECHO(HZ)";TAB(61);"SKY(K)"
1200 IF IP=-1 THEN GOSUB 11010
2000 TM=GM:GOSUB 9500:GOSUB 9700
2100 GOSUB 7000:GOSUB 9000
2110 GOSUB 9100:GOSUB 7200:GOSUB 8900:IF ST>=SS GOTO 200
2120 IF CE<0 GOTO 3000
2130 GOSUB 9200:EL=CE:GOSUB 7300
2135 IF MT=30 OR MT=0 THEN PRINT
2140 PRINT HR;":";MT;TAB(16);
2150 PRINT USING "###.#"; FNA(AZ);
2160 PRINT TAB(28);:PRINT USING "##.#";FNA(EL);:PRINT TAB(45);INT(DV);:GOSUB 15100
2170 IF IP=-1 THEN GOSUB 12135
3000 GM=GM+DT:IF GM<24 GOTO 2000
3010 GM=GM-24:DN=DN+1:IF GM<24 GOTO 1000
3020 GOTO 3010
6000 D=DN+GM/24
6010 MS=TP*FNC(D/365.242 - .010452395#)
6020 MA=MS:EO=.016718
6030 GOSUB 10000
6040 EW=TA+4.932237686000004#
6050 EN=0:RETURN
6100 D=DN:GOSUB 6010:GOSUB 9000:GOSUB 9400
6110 T4=TR:T5=TS
6120 EW=EW+.017203:GOSUB 9000:GOSUB 9400
6130 GS=-E*24/TP+(24.07*T4/(24.07+T4-TR))
6140 GOSUB 9600:TR=TM
6150 GS=-E*24/TP+(24.07*T5/(24.07+T5-TS))
6160 GOSUB 9600:TS=TM
6170 RETURN
7000 D=DN+GM/24
7010 EW=FNB(1.134193#+D*.2299715060000012#)
7020 MM=FNB(1.319238#+D*.228027135#)
7030 T1=FNB(6.217512000000011#+D*.01720196977#)
7040 T2=2*FNB(2.550677#+D*.212768711#)
7050 T3=FNB(4.7652214#+D*.230895723#)
7060 EW=EW+.01148*SIN(T2)+.10976*SIN(MM)-.022235*SIN(MM-T2)
7070 EW=EW-.003246*SIN(T1)+.003735*SIN(2*MM)-.0019897*SIN(2*T3)
7080 EW=EW-.0010297*SIN(2*MM-T2)-.0009948*SIN(MM+T1-T2)
7090 EN=T3+.011507*SIN(T2)+.10873924#*SIN(MM)-.0222006*SIN(MM-T2)
7100 EN=.0897797*SIN(EN)-.002548*SIN(T3-T2)
7110 RETURN
7200 RO=.996986/(1+.0549*COS(MM+.10976*SIN(MM)))
7210 CE=EL-RO*.0166*COS(EL)
7220 RETURN
7300 T2=.10976
7310 T1=MM+T2*SIN(MM)
7320 DV=.01255*RO*RO*SIN(T1)*(1+T2*COS(MM))
7330 DV=DV*4449
7340 T1=6378:T2=384401!
7350 T3=T1*T2*(COS(DC)*COS(N)*SIN(LH))/SQR(T2*T2-T2*T1*SIN(EL))
7360 DV=DV+T3*.0753125
7370 DV=-DV*2*432/299.8:' Doppler (Hz); *2 is for echo; F = 432 MHz
7380 RETURN
7400 SI=SIN(LH)*COS(DC)*COS(N)
7410 CO=SIN(N)-SIN(DC)*SIN(EL)
7420 GOSUB 9900:PO=TH
7430 RETURN
8000 T1=YR:T2=MN
8010 IF T2>2.5 GOTO 8030
8020 T1=T1-1:T2=T2+12
8030 DN=INT(365.25*(T1-1980))-INT(T1/100)+INT(T1/400)-16
8040 DN=DN+DY+30*T2+INT(.6*T2-.3)
8050 RETURN
8100 T1=INT(DN-7*INT(DN/7)+.5)
8110 D$=MID$(" MON TUESWEDNES THURS FRI SATUR SUN",6*T1+1,6)+"DAY"
8120 RETURN
8200 T2=INT(DN-39410!)
8210 T1=INT((T2+32044.8)/36524.3)
8220 T1=T1+T2-INT(T1/4)+1486
8230 YR=INT((T1-122.1)/365.25)
8240 T1=T1-INT(365.25*YR)
8250 MN=INT(T1/30.6001)
8260 DY=T1-INT(30.6001*MN)
8270 YR=YR+2084:MN=MN-1
8280 IF MN<12.5 GOTO 8300
8290 YR=YR+1:MN=MN-12
8300 RETURN
8900 IF CE>0 THEN UP=1: RETURN
8910 IF CE=<0 AND UP=0 THEN RETURN
8920 IF CE=<0 AND UP=1 THEN ST=ST+1: UP=0
8930 GOSUB 7200
8940 PRINT TAB(40);:PRINT "DEC ";:PRINT USING "###.#";FNA(DC):PRINT TAB(40);
8950 PRINT"SIGNALS ";:PRINT USING "##.#";FNA(-17.37*DR*LOG(RO));:PRINT" dB"
8960 IF IP=-1 THEN LPRINT FF$
8970 RETURN
9000 SI=C1*SIN(EN)+S1*COS(EN)*SIN(EW)
9010 CO=SQR(1-SI*SI):GOSUB 9900
9020 DC=TH
9030 SI=SIN(EW)*C1-TAN(EN)*S1
9040 CO=COS(EW):GOSUB 9900
9050 RA=TH:IF RA<0 THEN RA=RA+TP
9060 RETURN
9100 T1=GS/24-RA/TP:GH=TP*FNC(T1)
9110 LH=GH+E
9120 SI=COS(LH)*COS(DC)*COS(N)+SIN(DC)*SIN(N)
9130 CO=SQR(1-SI*SI):GOSUB 9900
9140 EL=TH
9150 RETURN
9200 SI=-SIN(LH)*COS(DC)*COS(N)
9210 CO=SIN(DC)-SIN(N)*SIN(EL):GOSUB 9900
9220 AZ=TH:IF AZ<0 THEN AZ=AZ+TP
9230 RETURN
9300 GOSUB 9400:IF TR<0 THEN RETURN
9310 T3=GS
9320 GS=TR:GOSUB 9600:TR=TM
9330 GS=TS:GOSUB 9600:TS=TM
9340 GS=T3:RETURN
9400 CO=SIN(DC)/COS(N)
9410 IF ABS(CO)>1 GOTO 9490
9420 SI=SQR(1-CO*CO):GOSUB 9900
9430 AR=TH:AS=TP-AR
9440 CO=-TAN(N)*TAN(DC)
9450 SI=SQR(1-CO*CO):GOSUB 9900
9460 TR=24*FNC((RA-TH-E)/TP)
9470 TS=24*FNC((RA+TH-E)/TP)
9480 RETURN
9490 TR=-1:TS=-1:RETURN
9500 MT=INT(TM*60+.5):HR=INT(MT/60)
9510 MT=MT-HR*60:RETURN
9600 T1=(GS-SE-.0657098*(DN-DE))/24
9610 TM=23.9345*(T1-INT(T1))
9620 RETURN
9700 T1=(SE+.0657098*(DN-DE)+GM*1.00274)/24
9710 GS=24*FNC(T1)
9720 RETURN
9800 T1=YR-1
9810 DE=INT(365.25*(T1-1980))-INT(T1/100)+INT(T1/400)+381
9820 T1=(DE+29218.5)/36525!
9830 T1=6.6460656#+T1*(2400.051262#+T1*2.581E-05)
9840 SE=T1-24*(YR-1900)
9850 RETURN
9900 T1=ABS(SI):T2=ABS(CO)
9910 IF T1>T2 THEN TH=PT-ATN(T2/T1)
9920 IF T1<=T2 THEN TH=ATN(T1/T2)
9930 IF CO<0 THEN TH=PI-TH
9940 IF SI<0 THEN TH=-TH
9950 RETURN
9999 ' Routine to calculate true anomaly by Kepler's equation
10000 EA=MA
10010 T1=EA-EO*SIN(EA)-MA
10020 IF ABS(T1)<.0000001 GOTO 10050
10030 EA=EA-T1/(1-EO * COS(EA))
10040 GOTO 10010
10050 TA=SQR((1+EO)/(1-EO))*TAN(EA/2)
10060 TA=2*ATN(TA)
10070 RETURN
11010 LPRINT:LPRINT D$,DY;" ";MN$;" ";YR
11020 LPRINT:LPRINT
11100 LPRINT" GMT";TAB(15);"AZIMUTH";TAB(25);"ELEVATION";TAB(43);"ECHO (Hz)"
11110 RETURN
12135 IF MT=0 OR MT=30 THEN LPRINT
12140 LPRINT HR;":";MT;TAB(16);
12150 LPRINT USING "###.#"; FNA(AZ);
12160 LPRINT TAB(28);:LPRINT USING "##.#";FNA(EL);:LPRINT TAB(45);INT(DV)
12170 RETURN
15000 FOR I=1 TO 24:FOR J=6 TO 1 STEP -1
15010 READ SKY(I,J):NEXT J:NEXT I
15018 ' 400MHz sky temperatures, from R E Taylor, Proc IEEE Apr 1973 p469
15019 ' I=GHA; J=Dec 30to20,20to10,...,-20to-30; ie grid is 15x10 degrees.
15020 DATA 23,23,23,25,25,22, 25,25,25,25,25,20, 30,30,27,24,20,19, 30,30,24,22,18,18
15030 DATA 35,33,25,23,19,16, 43,41,34,30,24,17, 35,38,35,35,32,25, 25,25,28,30,34,32
15040 DATA 17,17,17,19,22,28, 15,16,15,18,20,23, 17,17,17,17,19,22, 18,18,19,20,23,23
15050 DATA 20,24,26,25,25,25, 24,30,25,25,26,30, 33,35,28,28,32,34, 38,42,35,32,36,43
15060 DATA 42,55,44,40,48,80, 38,50,70,90,110,200, 60,80,120,160,150,180, 70,75,100,90,70,50
15070 DATA 55,40,40,34,29,29, 45,27,22,28,25,22, 27,27,20,20,21,20, 23,23,21,23,25,22
15080 RETURN
15100 GHA=INT(1+RA*RD/15):DEC=INT(DC*RD/10)+4
15109 ' 400MHz temperatures corrected to 432MHz by (400/432)^2.4 = 1/1.2
15110 PRINT;TAB(61);INT(SKY(GHA,DEC)/1.2)
15120 RETURN